from comment.modules import db
from sqlalchemy import ForeignKey


class Account(db.Model):
    """
    资金账户模型
    """
    __tablename__ = 't_account'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    userId = db.Column(db.BIGINT, ForeignKey('t_user.id'), comment='用户表主键')
    user = db.relationship('User', backref=db.backref('accountInfo', lazy=True, uselist=False))
    total = db.Column(db.Float(10, 2), comment='帐户总额', default=0)
    balance = db.Column(db.Float(10, 2), comment='帐户可余额', default=0)
    frozen = db.Column(db.Float(10, 2), comment='账户总计冻结总额', default=0)
    investmentW = db.Column(db.Float(10, 2), comment='总计待收本金', default=0)
    interestTotal = db.Column(db.Float(10, 2), comment='总计待收利息', default=0)
    addCapitalTotal = db.Column(db.Float(10, 2), comment='月投总额', default=0)
    recyclingInterest = db.Column(db.Float(10, 2), comment='月取总额', default=0)
    capitalTotal = db.Column(db.Float(10, 2), comment='月乘总额', default=0)
    inverstmentA = db.Column(db.Float(10, 2), comment='已投资总额', default=0)
    interestA = db.Column(db.Float(10, 2), comment='已赚取利息', default=0)
    uApplyExtractMoney = db.Column(db.Float(10, 2), comment='申请提现金额', default=0)
    discount = db.Column(db.Float(8, 2), comment='代金券的总金额', default=0)